from flask import jsonify
from .studyHistoryResource import studyHistoryResource, studyListHistoriesResource
from .userResource import UserResource, UserLoginResource
from .indexResource import IndexResource
from .noteResource import NoteResource, NoteFolderResource, NoteListResource, NoteOtherResource
from .materialResource import MaterialResource, MaterialListResource
from .collectResource import CollectResource, CollectListResource
from . import main_rest_api


note_api = main_rest_api.namespace("note相关Api", path="/note")
note_api.add_resource(NoteResource, "", endpoint="note")
note_api.add_resource(NoteListResource, "/list", endpoint="note_list")
note_api.add_resource(NoteOtherResource, "/other", endpoint="note_other")
note_api.add_resource(NoteFolderResource, "/folder", endpoint="note_folder")

material_api = main_rest_api.namespace("material相关Api", path="/material")
material_api.add_resource(MaterialResource, "/get_study_information", endpoint="get_study_information")
material_api.add_resource(MaterialListResource, "/get_study_code_list", endpoint="get_code_list")

collect_api = main_rest_api.namespace("collect相关Api", path="/collect")
collect_api.add_resource(CollectResource, '', endpoint='collect')
collect_api.add_resource(CollectListResource, '/list', endpoint='collect_list')

user_api = main_rest_api.namespace("user相关Api", path="/user")
user_api.add_resource(UserResource, '', endpoint='user')
user_api.add_resource(UserLoginResource, '/login', endpoint='login')

index_api = main_rest_api.namespace("主页相关Api", path="/index")
index_api.add_resource(IndexResource, '/get_study_node_title', endpoint='index')

study_history_api = main_rest_api.namespace("study_history相关api", path='/study_history')
study_history_api.add_resource(studyHistoryResource, '', endpoint='study_history')
study_history_api.add_resource(studyListHistoriesResource, '/list', endpoint='study_list_histories')